using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;

namespace Accio {
	public class MailboxType {
        public static readonly MailboxType[] MAILBOX_TYPES;

        static MailboxType(){
            MAILBOX_TYPES = LoadMailboxTypes();
        }

        private static MailboxType[] LoadMailboxTypes() {
            List<MailboxType> mailboxTypes = new List<MailboxType>();
            XmlDocument doc = new XmlDocument();
            doc.Load("mailbox_types.xml");
            XmlNodeList typeNodes = doc.SelectNodes("//type");
            foreach (XmlNode typeNode in typeNodes) {
                mailboxTypes.Add(new MailboxType(typeNode.SelectSingleNode("title").InnerText, typeNode.SelectSingleNode("id").InnerText));
            }
            return mailboxTypes.ToArray();
        }

		public MailboxType(string display, string value) {
			displayName = display;
			valueName = value;
		}
		public string DisplayName {
			get {
				return displayName;
			}
		}
		public string ValueName {
			get {
				return valueName;
			}
		}
		private string displayName = "";
		private string valueName = "";
	}
}
